package com.crecheng.shop.Manage;

import com.crecheng.shop.DAO.UserOderData;
import com.crecheng.shop.util.ConSQL;
import com.crecheng.shop.util.ListUtil;

import java.util.List;

public final class UserOderManage {
    public static List<UserOderData> getAll(){
        return ConSQL.select(UserOderData.class);
    }

    public static List<UserOderData> get(String other){
        return ConSQL.select(UserOderData.class,other);
    }

    public static UserOderData get(int id){
        return ListUtil.first(get("id="+id));
    }

    public static List<UserOderData> getByUser(int uid){
        return get("uid="+uid);
    }

    public static boolean add(UserOderData data){
        return ConSQL.insert(UserOderData.class,data)>0;
    }

    public static boolean del(int id){
        return ConSQL.delete(UserOderData.class,"id="+id)>0;
    }
}
